<template>
  <view class="detail-ap">
    <view class="tabList">
      <v-tabs
        v-model="tabCurrent"
        :scroll="false"
        :tabs="tabList"
        @change="tabChange"
      ></v-tabs>
    </view>
    <view class="main">
      <view
        class="mian-title"
        :style="{ height: detailList.isClosed == 0 ? '196rpx' : '96rpx' }"
      >
        <view class="xq_title"> 消纳审核（工程类） </view>
        <view class="xq_type" v-if="detailList.isClosed == 0">
          当前节点：{{ nodeName }}
        </view>
        <view class="" style="padding: 36rpx" v-if="detailList.isClosed == 0">
          <!-- stepsnumber01234 -->
          <steps :steps="numList" :current="stepsnumber"></steps>
        </view>
      </view>

      <view class="mian-content">
        <view class="forms" v-if="tabCurrent == 0">
          <view class="Category_title">
            <view class="line"></view>消纳场地信息
          </view>
          <view class="items" v-if="finnished">
            <view class="field"> </view>
            <view class="content" style="color: #2979ff"> pdf已生成 </view>
          </view>
          <view class="items">
            <view class="field"> 申请人 </view>
            <view class="content">
              {{ detailmsg.applicant || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 联系方式 </view>
            <view class="content">
              {{ detailmsg.contact || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 身份证号码 </view>
            <view class="content">
              {{ detailmsg.identityCard || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 场地类型 </view>
            <view class="content"> 项目 </view>
          </view>
          <view class="items">
            <!-- <view class="field">
							消纳场地名称
						</view>
						<view class="content">
							{{detailmsg.fieldName || '暂无' }}
						</view> -->
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              消纳场地名称
            </view>
            <view class="content" style="color: #363a44" v-if="xiaonaEdit == 1">
              <!-- <input :enableNative="false" :value="detailmsg.fieldName" type="textarea" placeholder="暂无" /> -->
              <textarea
                @input="inputsName"
                :enableNative="false"
                rows="3"
                cols="20"
                :value="detailmsg.fieldName"
                placeholder="暂无"
              />
            </view>
            <view class="content" v-else>
              {{ detailmsg.fieldName || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 所在街镇 </view>
            <view class="content">
              {{ detailmsg.street || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 场地地址 </view>
            <view class="content">
              {{ detailmsg.fieldAddress || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 具体地址 </view>
            <view class="content">
              {{ detailmsg.fieldAddressDetailed || "暂无" }}
            </view>
          </view>
          <!-- 现场踏勘阶段和自规局审核可编辑地图 -->
          <view
            class="items"
            @click="navigationToEvent"
            v-if="
              (stepsnumber == 1 && xiaonaEdit == 1) ||
              (stepsnumber == 3 && xiaonaEdit2 == 1)
            "
          >
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              四至范围
            </view>
            <view class="content">
              {{ path == 1 ? "" : "已绘制" }}
            </view>
            <img class="arrow" src="/static/arrow.png" />
          </view>
          <view class="items" v-else>
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              四至范围
            </view>
            <view class="content">
              <span v-if="path != 1">已绘制</span>
            </view>
          </view>

          <view class="map-panel" v-if="path != 1">
            <map-view
              :polygons="polygons"
              :center="center"
              :area="mapArea"
            ></map-view>
          </view>
          <view class="items">
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              主管部门
            </view>
            <view
              style="color: rgb(54, 58, 68)"
              v-if="xiaonaEdit == 1"
              @click="choseDep()"
            >
              {{ detailmsg.competentDepartment || "请选择" }}
            </view>
            <view class="content" v-else>
              {{ detailmsg.competentDepartment || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              消纳开始时间
            </view>
            <view
              class="content"
              @click="showcalendar = true"
              style="color: #363a44"
              v-if="xiaonaEdit == 1"
            >
              {{ time || "暂无" }}
            </view>
            <view class="content" v-else>
              {{ time || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field" :class="[xiaonaEdit == 1 ? 'edit-field' : '']">
              预计结束时间
            </view>
            <view
              class="content"
              @click="showcalendar = true"
              style="color: #363a44"
              v-if="xiaonaEdit == 1"
            >
              {{ time1 || "暂无" }}
            </view>
            <view class="content" v-else>
              {{ time1 || "暂无" }}
            </view>
          </view>

          <view
            class="items"
            style="
              background-color: #e7f3ff;
              width: 750rpx;
              margin-left: -26rpx;
            "
          >
            <view class="field"> </view>
            <view class="content" style="margin-left: 170rpx"> 总量 </view>
            <view class="content"> 本年度量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              渣土(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.muckEarthQuantity1"
                ref="inputest"
                type="textarea"
                placeholder="0"
                @input="inputs"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.muckEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow1"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              黄土(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.loessEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs1"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.loessEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year1"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow2"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              种植土(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.plantingSoilEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs2"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.plantingSoilEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year2"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow3"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              泥浆(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.slurryEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs3"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.slurryEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year3"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow4"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              建筑废砖(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.wasterEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs4"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.wasterEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year4"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow5"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              宕渣(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.dangEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs7"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.dangEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year7"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow7"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view
              class="field"
              style="width: 392rpx"
              :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
            >
              其他(m³)
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.otherEarthQuantity1"
                type="number"
                placeholder="0"
                @input="inputs5"
                :disabled="inputed"
              />
            </view>
            <view class="content" style="color: #363a44">
              <input
                :enableNative="false"
                :value="detailmsg.otherEarthQuantity2"
                type="number"
                placeholder="0"
                @input="input_year5"
                :disabled="inputed"
              />
            </view>
            <view class="red_line" v-if="redshow6"> 应小于等于总量 </view>
          </view>
          <view class="items">
            <view class="field" style="width: 392rpx; color: #2f6aff">
              出土总量(m³)
            </view>
            <view class="content" style="margin-left: 20rpx">
              {{ detailmsg.allEarthQuantity1 || "0" }}
            </view>
            <view class="content">
              {{ detailmsg.allEarthQuantity2 || "0" }}
            </view>
          </view>
          <!-- <view class="items">
						<view class="field">
							<view  style="margin-bottom: 20rpx;" >消纳放量证明材料</view>
							<infocell
							type="image"
							label="营业执照"
							 :image="detailmsg.accommodationFieldApplication ? detailmsg.accommodationFieldApplication.split(','):[]"
							 ></infocell>
						</view>		
					</view> -->
          <!-- <view class="items">
						<view class="field" style="width: 350rpx;">
							消纳方量证明材料
							<view class="showpdf">
								<img class="pho" v-for="item in detailmsg.accommodationFieldApplication" :src="item || emp"
									@click="previewPic(item)" alt="">
							</view>
						</view>
					</view> -->
          <view class="items">
            <view class="field image-wrape-box">
              <view style="margin-bottom: 20rpx">消纳方量证明材料</view>
              <infocell
                type="image"
                label="营业执照"
                :image="
                  detailmsg.accommodationFieldApplication
                    ? detailmsg.accommodationFieldApplication.split(',')
                    : []
                "
              ></infocell>
            </view>
          </view>
          <view class="Category_title">
            <view class="line"></view>单位信息
          </view>
          <view class="items">
            <view class="field"> 业主单位 </view>
            <view class="content">
              {{ detailmsg.odsZhatuCompanyInfoOwner.company || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 统一信用代码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoOwner.unifiedCreditCode || "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人姓名 </view>
            <view class="content">
              {{ detailmsg.odsZhatuCompanyInfoOwner.legalPerson || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人身份证号码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoOwner.legalPersonIdcard || "暂无"
              }}
            </view>
          </view>

          <view class="items">
            <view class="field image-wrape-box">
              <view style="margin-bottom: 20rpx">营业执照</view>
              <infocell
                type="image"
                label="营业执照"
                :image="
                  detailmsg.odsZhatuCompanyInfoOwner
                    ? detailmsg.odsZhatuCompanyInfoOwner.businessLicense.split(
                        ','
                      )
                    : []
                "
              ></infocell>
            </view>
          </view>
          <view class="items">
            <view class="field"> 建设单位 </view>
            <view class="content">
              {{ detailmsg.odsZhatuCompanyInfoProject.company || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 统一信用代码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoProject.unifiedCreditCode || "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人姓名 </view>
            <view class="content">
              {{ detailmsg.odsZhatuCompanyInfoProject.legalPerson || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人身份证号码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoProject.legalPersonIdcard || "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field image-wrape-box">
              <view style="margin-bottom: 20rpx">营业执照</view>
              <infocell
                type="image"
                label="营业执照"
                :image="
                  detailmsg.odsZhatuCompanyInfoProject
                    ? detailmsg.odsZhatuCompanyInfoProject.businessLicense.split(
                        ','
                      )
                    : []
                "
              ></infocell>
            </view>
          </view>
          <view class="items">
            <view class="field"> 施工单位 </view>
            <view class="content">
              {{ detailmsg.odsZhatuCompanyInfoConstruction.company || "暂无" }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 统一信用代码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoConstruction.unifiedCreditCode ||
                "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人姓名 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoConstruction.legalPerson || "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 法人身份证号码 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoConstruction.legalPersonIdcard ||
                "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 项目负责人 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoConstruction.chargePerson || "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field"> 联系方式 </view>
            <view class="content">
              {{
                detailmsg.odsZhatuCompanyInfoConstruction.chargePersonNumber ||
                "暂无"
              }}
            </view>
          </view>
          <view class="items">
            <view class="field image-wrape-box">
              <view style="margin-bottom: 20rpx">营业执照</view>
              <infocell
                type="image"
                label="营业执照"
                :image="
                  detailmsg.odsZhatuCompanyInfoConstruction
                    ? detailmsg.odsZhatuCompanyInfoConstruction.businessLicense.split(
                        ','
                      )
                    : []
                "
              ></infocell>
            </view>
          </view>
          <view class="items">
            <view class="field image-wrape-box">
              <view style="margin-bottom: 20rpx">施工合同</view>
              <infocell
                type="image"
                label="施工合同"
                :image="
                  detailmsg.odsZhatuCompanyInfoConstruction
                    ? detailmsg.odsZhatuCompanyInfoConstruction.relatedContracts.split(
                        ','
                      )
                    : []
                "
              ></infocell>
            </view>
          </view>

          <view class="Category_title">
            <view class="line"></view>附件信息
          </view>
          <view
            class="items"
            style="flex-direction: column"
            v-for="(item, index) in nameList"
            :key="index"
          >
            <view class="" style="display: flex">
              <view
                class="field"
                :class="[xiaonaEdit == 1 ? 'edit-field' : '']"
                style="width: 400rpx"
              >
                {{ item.name }}
              </view>
            </view>
            <file-upload
              :editFlag="xiaonaEdit == 1"
              :listType="index"
              :picUrlList="item.picList"
              @updateUrlList="updateUrlList"
            ></file-upload>
          </view>
        </view>

        <circullog class="" v-else :ids="idd" :nodeName="nodeName"></circullog>
      </view>
    </view>
    <!-- 画地图 -->
    <u-popup
      v-model="showmap"
      mode="bottom "
      :border-radius="border_radius"
      mask
    >
      <view class="pop" style="height: 950rpx">
        <view class="title">
          <view class="" @click="showmap = false"> 取消 </view>
          <view class="" style="color: #007aff" @click="comfirm"> 确认 </view>
        </view>
        <view class="" style="margin: 50rpx 20rpx 50rpx 20rpx"> sdfds </view>
      </view>
    </u-popup>
    <!-- 审核通过弹窗 -->
    <u-popup
      v-model="showPass"
      mode="bottom "
      :border-radius="border_radius"
      mask
    >
      <view class="pop">
        <view class="title">
          <view class="" @click="showPass = false"> 取消 </view>
          <view class=""> 通过 </view>
          <view class="" style="color: #007aff" @click="onSure()"> 确认 </view>
        </view>
        <view class="" style="margin: 50rpx 20rpx 50rpx 20rpx">
          <u-input
            :enableNative="false"
            style=""
            v-model="pass_value"
            :type="type"
            :border="border"
            :maxlength="500"
            :height="height"
            placeholder="请输入通过意见"
          />
        </view>
      </view>
    </u-popup>
    <u-popup v-model="show" mode="bottom " :border-radius="border_radius" mask>
      <view class="pop">
        <view class="title">
          <view class="" @click="show = false"> 取消 </view>
          <view class="">
            {{ outorder == 1 ? "不通过" : outorder == 2 ? "退单整改" : "审核" }}
          </view>
          <view
            v-if="buttontype == 11"
            style="color: #007aff"
            @click="allocateout"
          >
            确认
          </view>
          <view v-else style="color: #007aff" @click="comfirm()"> 确认 </view>
        </view>
        <view class="" style="margin: 50rpx 20rpx 50rpx 20rpx">
          <u-input
            v-if="outorder == 2"
            :enableNative="false"
            style=""
            v-model="type_value"
            :type="type"
            :border="border"
            :maxlength="500"
            :height="height"
            placeholder="请输入退单整改意见"
          />
          <u-input
            v-else-if="outorder == 1"
            :enableNative="false"
            style=""
            v-model="type_value"
            :type="type"
            :border="border"
            :maxlength="500"
            :height="height"
            placeholder="请输入不通过意见"
          />
          <u-input
            v-else
            :enableNative="false"
            style=""
            v-model="type_value"
            :type="type"
            :border="border"
            :maxlength="500"
            :height="height"
            placeholder="请输入审核意见"
          />
        </view>
      </view>
    </u-popup>
    <u-popup
      v-model="showpart"
      mode="bottom "
      :border-radius="border_radius"
      mask
    >
      <view class="pop">
        <view class="title">
          <view class="" @click="showpart = false"> 取消 </view>
          <!-- <view class="">
						{{buttontype==10 ? '请选择参与部门' :'分派处置' }}
					</view> -->

          <view class="" style="color: #007aff" @click="comfirm_part">
            确认
          </view>
        </view>
        <view class="checkbox-group" v-if="buttontype == 10">
          <u-checkbox-group>
            <u-checkbox
              @change="checkboxChange"
              v-model="item.checked"
              v-for="(item, index) in list"
              shape="circle"
              size="45rpx"
              :key="index"
              :name="[item.orgId, item.orgName]"
              >{{ item.orgName }}</u-checkbox
            >
          </u-checkbox-group>
        </view>
        <view class="" style="margin: 50rpx 20rpx 50rpx 20rpx" v-else>
          <u-input
            style=""
            v-model="type_value"
            :type="type"
            :border="border"
            :height="height"
            placeholder="请填写审核意见"
          />
        </view>
      </view>
    </u-popup>
    <u-toast ref="uToast" />
    <view class="footer" v-if="cricul == 0 && !finnished">
      <view class="">
        <button
          class="taketask"
          v-if="orderType == 0"
          type="default"
          @click="taketask"
        >
          任务认领
        </button>
        <view class="footer" v-else>
          <!-- 1.是否通过 -->
          <!-- buttontype 1现场踏勘，3渣土办，自规局 11部门 -->
          <view class="footer" v-if="buttontype == 1">
            <button class="heyan" type="default" @click="canceltake">
              取消认领
            </button>
            <button class="heyan" type="default" @click="forward()">
              转发
            </button>
            <button class="heyan" type="default" @click="passout(1)">
              不通过
            </button>
            <button class="heyan" type="default" @click="passout(2)">
              退单整改
            </button>
            <!-- <button class="heyan" type="default" @click="passout(3)">上一节点</button> -->
            <button class="heyan" type="default" @click="approved()">
              通过
            </button>
          </view>
          <view class="footer" v-else-if="buttontype == 3">
            <!-- <button class="confim" type="default" @click="show=true">通过</button> -->
            <button class="heyan" type="default" @click="canceltake">
              取消认领
            </button>
            <button class="heyan" type="default" @click="forward()">
              转发
            </button>
            <button class="heyan" type="default" @click="passout(1)">
              不通过
            </button>
            <button class="heyan" type="default" @click="passout(2)">
              退单整改
            </button>
            <!-- <button class="heyan" type="default" @click="passout(3)">上一节点</button> -->
            <button class="heyan" type="default" @click="approved()">
              通过
            </button>
          </view>

          <view class="footer" v-else-if="buttontype == 10">
            <!-- <button class="cancel" type="default" @click="passout">关闭工单</button> -->
            <button class="cancel" type="default" @click="passout">
              不通过
            </button>
            <button class="confim" type="default" @click="forward()">
              转发
            </button>
            <button class="confim" type="default" @click="showpart = true">
              分派部门
            </button>
          </view>
          <view class="footer" v-else-if="buttontype == 11">
            <!-- <button class="heyan" type="default" @click="canceltake">取消认领</button> -->
            <button class="heyan" type="default" @click="passout(1)">
              不通过
            </button>
            <button class="heyan" type="default" @click="passout(2)">
              退单整改
            </button>
            <button class="heyan" type="default" @click="approved()">
              通过
            </button>
          </view>
          <!-- 2.审核意见 -->
          <!-- <button class="taketask" type="default" @click="show=true">
						{{buttontype==1 ? '核验':buttontype==2?'处置' : buttontype==3 ? '审核' : buttontype==4 ? '转派': buttontype==10 ?'分派':'分派中'  }}
					</button> -->
        </view>
      </view>
    </view>
    <!-- 部门更改 -->
    <u-picker
      v-model="departmentShow"
      mode="selector"
      :default-selector="[0]"
      :range="departmentList"
      @confirm="updateDep"
      range-key="name"
    ></u-picker>
    <appoint-task
      :recordId="id"
      :personShow="personShow"
      @appointTaskSuccess="appointTaskSuccess"
      @appointTaskCancel="appointTaskCancel"
    ></appoint-task>
    <view class="">
      <u-calendar
        v-model="showcalendar"
        :mode="mode"
        @change="setTime"
        max-date="2099-01-01"
      ></u-calendar>
    </view>
  </view>
</template>

<script>
import {
  getOrderDetail,
  getWorkOrderLogs,
  getTakeTask,
  postOrderHandle,
  orgByNodeId,
  allocate,
  allocatedo,
  getPdf,
  detailById,
  postWithdraw,
  postOrderAudit,
  getTransferDepartment,
  getNextPersons,
  postOrderDispatch,
  postCheck,
  getMyList,
} from "@/pages/api/orderp/orderp.js";
import { getByOrdersId, updatexiaona } from "@/pages/api/report/orderp.js";
import { uploadUrl } from "@/pages/api/report/helperOrderp.js";
import methodMix from "@/pages/index/approval/xiaona/methodMix_xn.js";
import circullog from "@/pages/index/approval/circulLog/index";
import steps from "@/components/orderStep/orderStep.vue";
import infocell from "@/components/infocell/infoCell.vue";
import fileUpload from "@/components/fileUpload/index.vue";
import mapView from "@/components/mapView/index.vue";
import appointTask from "@/components/appointTask/index.vue";
export default {
  mixins: [methodMix],
  components: {
    circullog,
    steps,
    infocell,
    fileUpload,
    appointTask,
    mapView,
  },
  data() {
    const currentDate = this.getDate({
      format: true,
    });
    return {
      personShow: false, //转发人员弹窗
      id: "",
      detailList: {},
      timeLeft: "",
      formarr: [],
      getphotolist: [],
      chuzhiphotolist: [],
      circulList: [],
      personList: [
        {
          realName: "12",
          id: 0,
        },
        {
          realName: "11",
          id: 0,
        },
      ], //人员列表
      types: [
        "新建",
        "核验",
        "处置",
        "审核",
        "转派",
        "上提",
        "关闭工单",
        "关闭",
      ],
      orderColor: [
        "#418AEC",
        "#00B853",
        "#FF9F00",
        "#F55545",
        "#00D0CE",
        "#418AEC",
        "#8941EC",
      ],
      chuzhiarr: [],
      show: false,
      showpart: false,
      showPass: false,
      showmap: false,
      closeable: false,
      type: "textarea",
      autoup: false,
      border: true,
      height: 240,
      type_value: "",
      pass_value: "", //审核通过意见
      border_radius: "30rpx",
      orderType: "",
      nodeId: "",
      list: [
        {
          nodeId: "19ca0a224aad5d408dd8ea23d1c813c0",
          orgId: "GO_df2f46315d414518a31bea909fbd67a6",
          orgName: "建设局",
          checked: true,
          disabled: false,
        },
        {
          nodeId: "19ca0a224aad5d408dd8ea23d1c813c0",
          orgId: "GO_df2f46315d414518a31bea909fbd67a6",
          orgName: "水利局",
          checked: false,
          disabled: false,
        },
        {
          nodeId: "19ca0a224aad5d408dd8ea23d1c813c0",
          orgId: "GO_df2f46315d414518a31bea909fbd67a6",
          orgName: "交通局",
          checked: false,
          disabled: false,
        },
        {
          nodeId: "19ca0a224aad5d408dd8ea23d1c813c0",
          orgId: "GO_df2f46315d414518a31bea909fbd67a6",
          orgName: "农业农村局",
          checked: false,
          disabled: false,
        },
        {
          nodeId: "19ca0a224aad5d408dd8ea23d1c813c0",
          orgId: "GO_df2f46315d414518a31bea909fbd67a6",
          orgName: "高新区建设局",
          checked: false,
          disabled: false,
        },
      ],
      activelist: [],
      flag: false,
      idd: "",
      buttontype: 0,
      list_1: [
        {
          name: "是",
          disabled: false,
        },
        {
          name: "否",
          disabled: false,
        },
      ],
      // u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
      value: [false, false, false, false, false, false, false],
      value1: "",
      value2: "",
      value3: "",
      value4: "",
      value5: "",
      value6: "",
      outorder: false,
      detailmsg: {},
      checkop: "",
      polyline: [],
      polygon: [],
      points: [],
      mapArea: 0,
      action: "http://172.21.188.5:8085/zhatu/file/upload",
      form: {
        chukou: [],
        chongxi: [],
        fangchen: [],
        // shipin: [],
        qita: [],
      },
      date: currentDate,
      date1: currentDate,
      showendTime: false,
      showstartTime: false,
      time: "2021-08-01",
      time1: "2021-08-01",
      showcalendar: false,
      mode: "range",
      tabList: ["审核详情", "审核历史"],
      tabCurrent: 0,
      nodeName: "",
      cricul: 0,
      polygons: [],
      numList: [
        {
          name: "提交申请",
        },
        {
          name: "现场踏勘",
        },
        {
          name: "部门审核",
        },
        {
          name: "自规局审核",
        },
        {
          name: "渣土办审核",
        },
      ],
      stepsnumber: 0,
      departmentShow: false,
      departmentList: [
        {
          id: 1,
          name: "德清县水利局",
        },
        {
          id: 2,
          name: "德清县交通运输局",
        },
        {
          id: 3,
          name: "德清县建设局",
        },
        {
          id: 4,
          name: "德清县农业农村局",
        },
        {
          id: 5,
          name: "高新区规划建设局",
        },
      ],
      nameList: [
        {
          name: "出口道路硬化",
          id: "excavatedMouthRoadSclerosis",
          picList: [],
        },
        {
          name: "冲洗设备",
          id: "flushingEquipment",
          picList: [],
        },
        {
          name: "防尘降尘",
          id: "dustControl",
          picList: [],
        },
        {
          name: "土壤监测",
          id: "soilMonitoring",
          picList: [],
        },
        {
          name: "其他",
          id: "other",
          picList: [],
        },
      ],
      redshow1: false,
      redshow2: false,
      redshow3: false,
      redshow4: false,
      redshow5: false,
      redshow6: false,
      redshow7: false,
      xiaonaEdit: null, // 现场踏勘可编辑
      xiaonaEdit2: null, // 渣土办审核地图可编辑 1
      center: [],
      finnished: false,
      activeOrgName: [], //分配部门
    };
  },
  onShow() {
    if (this.$store.state.path != 1) {
      //已手动绘制

      let outArray2 = [];
      this.$store.state.path.forEach((item, index) => {
        outArray2.push({
          longitude: item[0],
          latitude: item[1],
        });
      });
      (this.polygons = [
        {
          // strokeColor: '#ff33ff80',
          strokeColor: "#FF33FF",
          strokeOpacity: 0.5,
          strokeWeight: 6,
          fillColor: "#1791fc80",
          points: outArray2,
        },
      ]),
        (this.center = this.$store.state.center);
      this.mapArea = this.$store.state.polygonArea;

      console.log(outArray2, "outArray2");
      console.log(this.$store.state.center, "this.$store.state.center");
    } else {
      if (this.detailmsg.limits && this.detailmsg.limitsCentre) {
        this.polygons = this.initMapData(this.detailmsg.limits);
        console.log(this.detailmsg.limitsCentre, "center");
        this.center = this.detailmsg.limitsCentre.split(",");

        this.mapArea = this.detailmsg.limitsArea;
      }
    }
    console.log(this.$store.state.path.toString(), "this.$store.state.path");
  },
  onLoad(op) {
    this.id = op.id;
    this.nodeId = op.nodeId;
    this.flag = op.flag;
    this.idd = op.idd;
    this.checkop = op.checkop;
    this.nodeName = op.nodeName;
    this.stepsnumber = op.stepsnumber;
    this.cricul = op.currenttab;
    this.xiaonaEdit = op.xiaonaEdit;
    this.xiaonaEdit2 = op.xiaonaEdit2 || null;
    this.$store.state.path = 1;
    this.$store.state.center = [];
    this.getolddetail();
    this.getdetail();
    this.getcircul();
  },
  created() {
    uni.$on("SetFinnishPdf", (param) => {
      console.log("接收到pdf: ", param);
      // this.$set(this.detailmsg, 'accommodationFieldApplication', param)
      // this.$set(this.detailmsg, 'finnished', true)
      this.$nextTick(() => {
        this.finnished = true;
        this.$toast("pdf已生成");

        const timeout = setTimeout(() => {
          clearTimeout(timeout);
          uni.navigateBack();
        }, 500);
      });
      // 如果是从通过进入则直接通过操作
      // if (param) {
      // 	updatexiaona({
      // 		accommodationFieldApplication:param,
      // 		id: this.detailmsg.id,
      // 	}).then(res=>{
      // 		// this.$set(this.detailmsg, 'finnished', true)

      // 	})
      // }
    });
  },
  destroyed() {
    uni.$off("SetFinnishPdf");
  },
  mounted() {},
  methods: {
    tabChange(index) {
      this.tabCurrent = index;
    },
    blur(e) {
      // console.log(e,this.detailmsg)
    },
    setTime(e) {
      console.log(e);
      this.time = e.startYear + "-" + e.startMonth + "-" + e.startDay;
      this.time1 = e.endYear + "-" + e.endMonth + "-" + e.endDay;
    },
    onchange(e) {
      const value = e.detail.value;
      console.log(value);
    },
    onnodeclick(node) {
      console.log(node);
    },
  },
};
</script>

<style lang="scss" scoped>
.detail-ap {
  height: 100vh;
  width: 750rpx;
  display: flex;
  flex-direction: column;

  .main {
    flex: 1;
    width: 750rpx;
    background-color: #f2f3f5;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;

    .mian-title {
      margin-top: 80rpx;
      padding: 32rpx;
      height: 196rpx;
      background-color: #ffffff;

      .xq_title {
        font-weight: 600;
        font-size: 40rpx;
        color: #363a44;
        margin-bottom: 24rpx;
      }

      .xq_type {
        font-size: 28rpx;
        color: #b5b7ba;
      }
    }
    .mian-content {
      flex: 1;
      height: 1rpx;
      overflow: hidden;
      overflow-y: auto;
    }
    .forms {
      // margin-top: 22rpx;
      padding: 26rpx 32rpx 26rpx 0rpx;
      width: 750rpx;
      background-color: #ffffff;
      border-radius: 10rpx;

      .Category_title {
        display: flex;
        font-weight: 600;
        font-size: 32rpx;
        color: #428ffc;
        height: 92rpx;
        background-color: #f6f7f8;
        line-height: 100rpx;
        padding-left: 32rpx;

        .line {
          height: 32rpx;
          margin: 32rpx 16rpx 0 0;
          width: 4rpx;
          background-color: #428ffc;
        }
      }

      .items {
        display: flex;
        padding: 26rpx 0 26rpx 0;
        font-size: 32rpx;
        margin-left: 32rpx;
        margin-right: 32rpx;
        border-bottom: 2rpx solid #e8e9ec;
        .image-wrape-box {
          width: 100% !important; //有图片的item
          .info-cell-class {
            width: 100% !important;
            .info-image {
              width: 100% !important;
              display: flex;
              flex-wrap: wrap;
              justify-content: flex-start;
            }
          }
        }
        .field {
          width: 242rpx;
          color: #b3b5b9;
          margin-right: 32rpx;

          .showpdf {
            margin-top: 16rpx;
            height: 200rpx;
            width: 200rpx;
            border: 1rpx solid #e8e9ec;
            border-radius: 10rpx;
            display: flex;
            justify-content: center;
            align-items: center;

            .pho {
              height: 200rpx;
              width: 200rpx;
            }

            .pdf {
              height: 128rpx;
              width: 104rpx;
            }
          }
        }
        .edit-field {
          color: rgb(54, 58, 68);
        }
        .content {
          width: 440rpx;
          color: #b3b5b9;
          // color: #363A44;
        }
      }
      .map-panel {
        width: 100%;
        height: 500rpx;
      }
      .line {
        height: 5rpx;
        background-color: #f2f3f5;
      }
    }

    .circul {
      display: flex;
      margin-left: 22rpx;
      margin-bottom: 40rpx;
      width: 750rpx;

      .type {
        margin-top: 22rpx;
        height: 50rpx;
        width: 50rpx;
        background-color: #2979ff;
        color: #ffffff;
        font-size: 31rpx;
        border-radius: 50%;
        text-align: center;
        line-height: 50rpx;
      }

      .circul_content {
        padding: 22rpx;
        margin-left: 22rpx;
        background-color: #ffffff;
        width: 588rpx;
        border-radius: 10rpx;

        .circul_field {
          margin-top: 22rpx;
        }
      }
    }
  }

  .footer {
    display: flex;
    justify-content: center;

    width: 750rpx;
    height: 128rpx;
    background-color: #ffffff;
    font-size: 29rpx;
    box-shadow: 2rpx 0 6rpx rgba(0, 0, 0, 0.12), 0 0 6rpx rgba(0, 0, 0, 0.04);
    .heyan {
      height: 87rpx;
      width: 170rpx;
      border: 1rpx solid #428ffc;
      border-radius: 20rpx;
      font-size: 25rpx;
      color: #ffffff;
      background-color: #428ffc;
      margin-top: 14rpx;
      // margin-right: 5rpx;
      margin-left: 12rpx;
    }
    .cancel {
      height: 87rpx;
      width: 339rpx;
      border: 1rpx solid #428ffc;
      border-radius: 50rpx;
      color: #428ffc;
      margin-top: 14rpx;
      // margin-left: 32rpx;
    }

    .confim {
      height: 87rpx;
      width: 339rpx;
      border: 1rpx solid #428ffc;
      border-radius: 50rpx;
      background-color: #428ffc;
      color: #ffffff;
      margin-top: 14rpx;
      margin-left: 16rpx;
    }

    .taketask {
      height: 87rpx;
      width: 692rpx;
      line-height: 87rpx;
      border: 1rpx solid #428ffc;
      border-radius: 50rpx;
      background-color: #428ffc;
      color: #ffffff;
      margin-top: 14rpx;
    }
  }
}

.pop {
  height: 750rpx;
  border-radius: 20rpx;

  .pop_title {
    color: #363a44;
    font-size: 32rpx;
    padding: 40rpx 0 32rpx 32rpx;
    border-bottom: 1rpx solid #efefef;
  }

  .title {
    padding: 20rpx;
    display: flex;
    justify-content: space-between;
  }

  .checkbox-group {
    padding: 20rpx;
  }
}
#navi_map {
  height: 550rpx;
}
.map_box {
  height: 550rpx;
}
img {
  height: 116rpx;
  width: 116rpx;
  margin-right: 20rpx;
}
.tabList {
  height: 80rpx;
  width: 750rpx;
  z-index: 99;
  position: fixed;
  top: 0rpx;
  background-color: #ffffff;
  border-bottom: 0.5rpx solid #dbdbdb;
}
.arrow {
  margin-left: 50rpx;
  height: 30rpx;
  width: 30rpx;
}
</style>
